package com.relman.command
{

	import com.adobe.cairngorm.control.CairngormEvent;
	import com.adobe.cairngorm.commands.ICommand;

	import com.relman.model.RelmanModelLocator;
	import com.relman.business.RelmanDelegate;
	import com.relman.control.ListManagersEvent;
	
	import com.relman.util.DebugUtils;

	import mx.controls.Alert;
	import mx.rpc.IResponder;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.collections.XMLListCollection;
	

	public class ListManagersCommand implements ICommand, IResponder
	{
		public function execute(event:CairngormEvent):void
		{
		    var delegate : RelmanDelegate = new RelmanDelegate( this )
		    delegate.listManagers();
		}
		
		public function result(data:Object):void
		{
			var model : RelmanModelLocator = RelmanModelLocator.getInstance();
			//DebugUtils.debug("results back from method...");
			//DebugUtils.debug(data.result.children().toString());
            model.managersXLC = new XMLListCollection(XMLList(data.result.children()));
		}
		
		public function fault(info:Object):void
		{
			var faultEvent :FaultEvent = FaultEvent( info )
			Alert.show( "Fault in ListManagers" )
		}
		
	}
}
